<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNewsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->increments('id')->comment('新闻id');
            $table->string('title',100)->comment('新闻标题');
            $table->string('picture', 200)->nullable()->comment('新闻图片');
            $table->tinyInteger('type')->nullable()->comment('新闻类型 1:政策动态2:志愿党建3:本地动态');

            $table->string('description', 8000)->nullable()->comment('新闻详情：富文本');
//            $table->tinyInteger('news_status')->default(2)->unsigned()->nullable()->comment('审核状态：1=已取消，2=待审核，3=已通过，4=未通过');

            $table->integer('province_id')->unsigned()->nullable()->comment('地址所在省份id');
            $table->foreign('province_id')->references('id')->on('provinces');

            $table->integer('city_id')->unsigned()->nullable()->comment('地址所在城市id');
            $table->foreign('city_id')->references('id')->on('cities');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('news');
    }
}
